package org.fly.controller.admin;

import org.fly.bean.query.ProductStatisticsQuery;
import org.fly.bean.warpper.BaseStatistics;
import org.fly.controller.AbstractController;
import org.fly.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by rongzhao.zhu on 2018/3/8.
 */
@Controller
@RequestMapping("/admin/statistics/")
public class AdminStatisticsController extends AbstractController {

    @Autowired
    ProductService productService;
    @RequestMapping(value = "queryOrderStatistics", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String queryOrderStatistics(ProductStatisticsQuery query ){
        List<BaseStatistics> baseStatistics = productService.statistics(query);
        return toJSONString(createDataTip(baseStatistics));
    }
}
